home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1996 January / macformat-033.iso / mac / Shareware City / Developers / ABox.v1.8 / Header Files / ABObject.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-23  |  5.6 KB  |  187 lines  |  [TEXT/MMCC]

  1. /*    
  2.     Copyright © 1991-1995 by TopSoft Inc.  All rights reserved.
  3.  
  4.     You may distribute this file under the terms of the TopSoft
  5.     Artistic License, accompanying this package.
  6.     
  7.     This file was developed by George (ty) Tempel in connection with TopSoft, Inc..
  8.     See the Modification History for more details.
  9.  
  10. Product
  11.     About Box
  12.  
  13. FILE
  14.     ABObject.h
  15.  
  16. NAME
  17.     ABObject.h, part of the ABox project source code,
  18.     responsible for handling the AboutBox resource (element) class stuff.
  19.  
  20. DESCRIPTION
  21.     This file contains defines for the about box modules.
  22.     
  23. DEVELOPED BY
  24.     George (ty) Tempel                netromancr@aol.com
  25.     All code in this file, and its associated header file was
  26.     Created by George (ty) Tempel in connection with the TopSoft, Inc.
  27.     "FilterTop" application development, except where noted.
  28.  
  29. CARETAKER - George (ty) Tempel <netromancr@aol.com>
  30.      Please consult this person for any changes or suggestions to this file.
  31.  
  32. MODIFICATION HISTORY
  33.  
  34.     dd mmm yy    -    xxx    -    patchxx: description of patch
  35.     9 June 94    -    ty    -    Initial Version Created
  36.     20-july-94    -    ty    -    initial version released
  37.     12-aug-94    -    ty    -    added mix in class ABUEnvQD for quickdraw
  38.                             feature handling
  39.     10-mar-95    -    ty    -    1.2 removed utility methods from here to ABUEnvQD
  40.                                 since they were quickdraw related; inclusion of some
  41.                                 new methods for handling DeviceLoop driven 3d frames
  42.                                 of the object (pretty neat stuff!)
  43.  
  44.     23-may-95    -    ty    -    changes for compatibility with the CodeWarrior CW6
  45.                             release and the associated Universal Headers from Apple:
  46.                             most methods that returned references now have "Ref" at
  47.                             the end of their methods names to prevent possible collisions
  48.                             with datatypes and classes of the same name (older versions
  49.                             of the compiler didn't have a problem with this).
  50.  
  51. */
  52.  
  53. /*===========================================================================*/
  54.  
  55. /*========== Exclusion Macros ============*/
  56.  
  57. #pragma    once
  58.  
  59. #ifndef    _ABObject_
  60. #define    _ABObject_
  61.  
  62.  
  63. /*============ Header Files ==============*/
  64.  
  65. #include    "ABProperties.h"
  66. #include    "ABUEnvQD.h"
  67.  
  68.  
  69. /*=========== External Linkage ===========*/
  70.  
  71. /*================ Macros ================*/
  72.  
  73. /*============== Constants ===============*/
  74.  
  75. #define    kABObjectRefCon        'OBrc'
  76. #define    kABObjectRefConSize    (sizeof(long))
  77.  
  78. #define    kABObjectVisible    'OBvi'
  79. #define    kABObjectVisibleSize    (sizeof(Boolean))
  80.  
  81. #define    kABObjectRect            'Orct'
  82. #define    kABObjectRectSize        (sizeof(Rect))
  83.  
  84. //    a set of colors used in drawing things,
  85. //    such as the bezel, in a pseudo-three-dimensional fashion.
  86. //    Suggestions for these colors came from _develop_ issue #15
  87. #define    k3D_lineWhite            ((unsigned short)(0xffff))
  88. #define    k3D_lineLightGrey        ((unsigned short)(0xeeee))
  89. #define    k3D_lineMedLightGrey    ((unsigned short)(0xaaaa))
  90. #define    k3D_lineMedDarkGrey        ((unsigned short)(0x8888))
  91. #define    k3D_lineDarkGrey        ((unsigned short)(0x5555))
  92. #define    k3D_lineBlack            ((unsigned short)(0x0000))
  93.  
  94.  
  95. /*================ Enums =================*/
  96.  
  97. enum {
  98.         kABMessageDraw = 300,
  99.         kABMessageUpdate,
  100.         kABMessageEvent,
  101.         kABMessageStop,
  102.         kABMessageCheckFile
  103.     };
  104.     
  105.     
  106. /*=============== Structs ================*/
  107.  
  108. /*=============== Typedefs ===============*/
  109.  
  110. /*=========== Class Definitions ==========*/
  111.  
  112. #define    kABObjectSuperProperty    ABProperties
  113. class    ABObject : ABProperties, private ABUEnvQD
  114. {
  115.     public:
  116.                         ABObject(void);
  117.         virtual            ~ABObject(void);
  118.  
  119.         virtual    OSErr    Draw(WindowPtr window);
  120.         virtual    OSErr    Update(WindowPtr window);
  121.         virtual    Boolean    Event(EventRecord *event);
  122.         virtual    OSErr    Stop(void);
  123.         virtual    Boolean    CheckFile(FSSpecPtr fssptr);
  124.         
  125.         virtual    OSErr    GetProperty (ABProperty prop, void *ptr, long *ptrSize);
  126.         virtual    OSErr    SetProperty (ABProperty prop, void *ptr, long ptrSize);
  127.         
  128.         virtual    OSErr    Resize(Rect const *field);
  129.         
  130.         virtual    OSErr    InitializeObject(void);
  131.         
  132.         virtual    OSErr    ScaleRectToFit(Rect& item, const Rect& area, float factor);
  133.         
  134.                 OSErr    EraseFrame (void) const;
  135.                 OSErr    DrawFrame (void) const;
  136.         
  137.         static    Boolean CanDraw3dBezel(short inDepth);
  138.         static    Boolean CantDraw3dBezel(short inDepth) { return ! ABObject::CanDraw3dBezel(inDepth); }
  139.             
  140.                 Boolean IsVisibleObject(void) const    { return this->VisibleObject() == true; }
  141.                 Boolean IsVisible(void) const        { return this->IsVisibleObject(); }
  142.                 Boolean IsInvisible(void) const        { return !this->IsVisibleObject(); }
  143.                 
  144.                 Boolean HasWindow(void) const        { return this->GetWindow() != NULL; }
  145.                 Boolean DoesntHaveWindow(void) const    { return ! this->HasWindow(); }
  146.                 
  147.                 WindowPtr    GetWindow(void) const        { return this->OurWindowRef(); }
  148.                 
  149.                 Boolean IsThisTheWindow(GrafPtr inWindow) const { return inWindow == this->GetWindow(); }
  150.                 Boolean NotOurWindow(GrafPtr inWindow) const { return ! this->IsThisTheWindow(inWindow); }
  151.                 
  152.                 Boolean IsTheFrontWindow(void) const { return this->GetWindow() == ::FrontWindow(); }
  153.                 Boolean NotTheFrontWindow(void) const { return !this->IsTheFrontWindow(); }
  154.             
  155.                 //    this/these method(s) are used via ::DeviceLoop() to handle multiple device
  156.                 //    drawing. Do not call them directly from your application!
  157.                 
  158.                 static pascal void DeviceLoopDrawFrame(short inDepth, short inDeviceFlags, GDHandle inDevice, long inUserData);
  159.                 
  160.     protected:
  161.                 long        mRefCon;
  162.                 Boolean        mVisibleObject;
  163.                 Rect        mObjectRect;
  164.                 WindowPtr    mOurWindow;
  165.                 
  166.                 Rect&        ObjectRect(void) const         { return this->mObjectRect; }
  167.                 Boolean&    VisibleObject(void) const    { return this->mVisibleObject; }
  168.                 long&        RefCon(void) const            { return this->mRefCon; }
  169.                 WindowPtr&    OurWindowRef(void) const        { return this->mOurWindow; }
  170.  
  171.                 static OSErr    EraseFrame (Rect& rect);
  172.                 static OSErr    DrawFrame (Rect& rect);
  173.         
  174.     private:
  175. };
  176.  
  177.  
  178.  
  179.  
  180. /*========== Function Prototypes =========*/
  181.  
  182.  
  183.  
  184.  
  185. #endif    // _ABObject_
  186.  
  187.